<template>
  <div>
    <zm-form label-width="120px" size="small" :model="form" :rules="formRule" ref="zmForm">
      <zm-form-item label="审批名称" prop="approveName">
        <zm-input class="w360" v-model="form.approveName" maxlength="20" placeholder="请输入审批名称,建议不超过20个字,用于工作台显示的审批名称" />
      </zm-form-item>
      <zm-form-item label="审批流图标" prop="iconUrl">
        <zm-image-upload v-model="form.iconUrl" :limit="1" accept=".jpg, .JPG, .jpeg, .JPEG, .png, .PNG"></zm-image-upload>
        <span>请上传图标,建议不超过60*60</span>
      </zm-form-item>
      <zm-form-item label="审批操作" prop="isEdit">
        <zm-radio-group v-model="form.isEdit">
          <el-radio label="0">无</el-radio>
          <el-radio label="1" :disabled="rowInfo.processType === '6' || rowInfo.processType === '11'">编辑</el-radio>
        </zm-radio-group>
      </zm-form-item>
      <zm-form-item label="审批人去重设置" prop="isRepeat">
        <zm-radio-group v-model="form.isRepeat">
          <el-radio label="0">无</el-radio>
          <el-radio label="1">审批人跟发起人相同时自动通过</el-radio>
        </zm-radio-group>
      </zm-form-item>
       <zm-form-item label="审批类型" prop="isCountersign">
        <zm-radio-group v-model="form.isCountersign">
          <el-radio label="1">会签(同一审批级别中需所有人同意)</el-radio>
          <el-radio label="0">或签(同一审批级别中一名审批人同意或拒绝即可)</el-radio>
        </zm-radio-group>
      </zm-form-item>
    </zm-form>
  </div>
</template>

<script>
import tableMixin from '@/mixins/zmTableMixin'
import ZmImageUpload from '@/components/ZmUpload/components/ImageUpload'
import approveProcessApis from '@/api/src/approveProcess'

import { formRuleOne } from '../const'
export default {
  name: 'StepOne',
  components: { ZmImageUpload },
  mixins: [tableMixin],
  props: {
    value: {
      type: Object,
      default () {
        return {}
      }
    },
    processId: {
      type: String,
      default: ''
    },
    rowInfo: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  data () {
    return {
      formRule: formRuleOne
    }
  },
  computed: {
    form: {
      get () {
        return this.value
      },
      set (val) {
        this.$emit('input', val)
      }
    }
  },
  watch: {},
  created () {
  },
  methods: {
    // 验证
    validate () {
      return this.$refs.zmForm ? this.$refs.zmForm.validate() : Promise.resolve()
    }
  }
}
</script>
